package com.work.formaldehyde.activityadapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.work.formaldehyde.R;

import java.util.ArrayList;

public class QuXiaoDingDanAdapter extends BaseAdapter {
    ArrayList<String> list;
    Context context;

    public QuXiaoDingDanAdapter(ArrayList<String> list, Context context) {
        // TODO Auto-generated constructor stub
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return list != null ? list.size() : 0;
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return list != null ? list.get(position) : 0;
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        convertView = LayoutInflater.from(context).inflate(R.layout.item_jiance_yuanyin, null);
        init i = new init();
        i.msg_jiance_item_title = convertView.findViewById(R.id.msg_jiance_item_title);
        i.woshi_item_check_img = convertView.findViewById(R.id.woshi_item_check_img);
        if (list.get(position).equals("1")) {
            i.woshi_item_check_img.setVisibility(View.GONE);
        }
        switch (position) {
            case 0:
                i.msg_jiance_item_title.setText("七天无理由退货");
                break;
            case 1:
                i.msg_jiance_item_title.setText("收到商品破损");
                break;
            case 2:
                i.msg_jiance_item_title.setText("商品错发/漏发");
                break;
            case 3:
                i.msg_jiance_item_title.setText("未按约定时间发货");
                break;
            case 4:
                i.msg_jiance_item_title.setText("商品质量有问题");
                break;
            case 5:
                i.msg_jiance_item_title.setText("商品拍错了");
                break;
            case 6:
                i.msg_jiance_item_title.setText("其他");
                break;
        }
        convertView.setTag(i);
        return convertView;
    }

    public static class init {
        //首页list的子控件
        ImageView woshi_item_check_img;
        TextView msg_jiance_item_title;
    }
}

